{// 加载头部公共文件 }
<include file="Public:header" />
<div class="main">
	<div class="content">
		<table id="checkList" class="list" cellpadding=0 cellspacing=0>
			<tr>
				<td height="3" colspan="2" class="toptd"></td>
			</tr>
			<tr class="row">
				<th colspan="2" class="space">物品发放</th>
			</tr>
			<tr class="row">
				<td width="15%">玩家名称:</td>
				<td><input type="text" id="uname" name="uname"/><button onclick="checkUser()">查询</button></td>
			</tr>
			<tr class="row">
				<td width="15%">钱币:
					<select id="mtype">
						<option value="gold">元宝</option>
						<option value="coin">金币</option>
						<option value="cash">礼券</option>
						<option value="bcoin">绑定金</option>
					</select>
				</td>
				<td><input type="text" id="money_count" name="money_count"  disabled/><button onclick="giveGold()" disabled id="moneyBtn">发放</button></td>
			</tr>
			<tr>
				<td height="3" colspan="2" class="bottomtd"></td>
			</tr>
		</table>
	</div>
</div>
<!-- 主页面结束 -->
{// 加载尾部公共文件 }
<script type="text/javascript">
	
	function giveGold()
	{
		var econtent = escape($("#uname").val());
		var gtype	=	$("#mtype").val();
		var gcount	=	$("#money_count").val();
		$.get("{:U('Game/addGold')}/type/"+gtype+"/user/" + userid+"/count/"+gcount, function(data) {
			alert(data);
		});
	}
	
	function resetAll()
	{
		$("#money_count").attr("disabled","true");
		$("#moneyBtn").attr("disabled","true");
	}
	
	function enableAll()
	{
		$("#money_count").removeAttr("disabled");
		$("#moneyBtn").removeAttr("disabled");
	}
	var userid	=	"";
	/**
	* 检查玩家
	**/
	function checkUser()
	{
		username	=	$("#uname").val();
		var urldata	=	{};
		urldata.type	=	"user";
		urldata.name	=	username;
		//var econtent = escape(username);
		$.get("{:U('Game/query')}",urldata, function(data) {
			if(data=="")
			{
				//玩家不存在
				resetAll();
			}
			else
			{
				enableAll();
				userid	=	data;
				$("#userinfo").html(userid);
			}
		});
	}
	
</script>